package a.a;

import a.c.ab;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.q;
import a.c.w;
import a.c.*;
import a.i.db;
import a.i.y;
import a.i.z;

import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;

public class n
{
  public static int a;
  
  public static int a(q paramq, x paramx, boolean paramBoolean, int paramInt1, int paramInt2, k paramk)
  {
    int j = m.b;
    if (j == 0) {
      if (paramq.n()) {
        return 0;
      }
    }
    if (j == 0)
    {
      if (paramInt1 > paramInt2) {
        throw new IllegalArgumentException("minGroupCount (" + paramInt1 + ") must not be greater than maxGroupCount (" + paramInt2 + ")");
      }
      if (j != 0) {}
    }
    else if (paramInt1 > paramq.j())
    {
      throw new IllegalArgumentException("minGroupCount (" + paramInt1 + ") must not be greater than graph.N() (" + paramq.j() + ")");
    }
    if (paramInt2 <= 0) {
      throw new IllegalArgumentException("maxGroupCount (" + paramInt2 + ") must be greater than 0");
    }
    pb localpb = new pb(paramq);
    a.c.n localn = null;
    if (paramk != null)
    {
      localn = localpb.C();
      localpb.c(localpb.w(), paramk, localn);
    }
    x localx = localpb.B();
    localpb.a(localpb.v(), paramx, localx);
    ib localib = new ib();
    int i = localib.a(localpb, localx, paramInt1, paramInt2, paramBoolean, localn);
    localpb.e(paramq.v(), localx, paramx);
    return i;
  }
  
  public static int a(q paramq, x paramx, double paramDouble, int paramInt1, int paramInt2, boolean paramBoolean)
  {
    int j = m.b;
    boolean bool = m.a;
    if (j == 0) {
      if (paramq.n()) {
        return 0;
      }
    }
    if (j == 0)
    {
      if (paramInt1 > paramInt2) {
        throw new IllegalArgumentException("minGroupCount (" + paramInt1 + ") must not be greater than maxGroupCount (" + paramInt2 + ")");
      }
      if (j != 0) {}
    }
    else if (paramInt1 > paramq.j())
    {
      throw new IllegalArgumentException("minGroupCount (" + paramInt1 + ") must not be greater than graph.N() (" + paramq.j() + ")");
    }
    if (paramInt2 <= 0) {
      throw new IllegalArgumentException("maxGroupCount (" + paramInt2 + ") must be greater than 0");
    }
    pb localpb = new pb(paramq);
    x localx = localpb.B();
    localpb.a(localpb.v(), paramx, localx);
    y localy = new y(localpb);
    localy.e();
    if (paramBoolean)
    {
      localObject = localpb.w();
      do
      {
        if (!((a.c.m)localObject).e()) {
          break;
        }
        d locald = ((a.c.m)localObject).a();
        if (j == 0)
        {
          if (localx.getInt(locald.e()) != localx.getInt(locald.f())) {
            localy.a(locald);
          }
          ((a.c.m)localObject).f();
        }
      } while (!bool);
    }
    Object localObject = new mb();
    if (j == 0) {
      if (paramDouble >= 0.0D) {
        if (j != 0) {
          break label340;
        }
      }
    }
    label340:
    ((mb)localObject).a(paramDouble > 1.0D ? 0.5D : paramDouble);
    ((mb)localObject).d(paramInt1);
    ((mb)localObject).c(paramInt2);
    int i = ((mb)localObject).a(localpb, localx);
    localpb.e(paramq.v(), localx, paramx);
    return i;
  }
  
  public static int a(q paramq, x paramx)
  {
    int i1 = m.b;
    boolean bool = m.a;
    if ((i1 != 0) || (l.d(paramq))) {
      return c(paramq, paramx);
    }
    pb localpb = new pb(paramq);
    x localx1 = localpb.B();
    x localx2 = localpb.B();
    int i = m.a(localpb, localx2);
    z localz = new z(localpb, localx2);
    localz.b();
    int j = 0;
    int k = 0;
    int m = 0;
    label212:
    label214:
    do
    {
      if (m >= i) {
        break;
      }
      Integer localInteger = new Integer(m);
      localz.c(localInteger);
      int n = c(localpb, localx1);
      if (bool) {
        break label234;
      }
      if (n == 0) {
        n = 1;
      }
      j += n;
      w localw = localpb.v();
      do
      {
        if (!localw.e()) {
          break;
        }
        e locale = localw.d();
        localx1.a(locale, localx1.getInt(locale) + k);
        localw.f();
        if (i1 != 0) {
          break label214;
        }
        if (bool) {
          break label212;
        }
      } while (!bool);
      k = j;
      if (i1 == 0) {
        m++;
      }
    } while (!bool);
    localz.g();
    localpb.e(paramq.v(), localx1, paramx);
    label234:
    return j;
  }
  
  private static int c(q paramq, x paramx)
  {
    int m = m.b;
    boolean bool = m.a;
    x localx1 = db.a(new Object[paramq.j()]);
    x localx2 = db.a(new boolean[paramq.j()]);
    a.c.n localn = db.b(new int[paramq.l()]);
    int i = m.a(paramq, localn, localx2);
    if ((m != 0) || (i < 1)) {
      return 0;
    }
    ab[] arrayOfab = m.a(paramq, localn, i);
    Arrays.sort(arrayOfab, new Comparator()
    {
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        return ((ab)paramAnonymousObject1).size() - ((ab)paramAnonymousObject2).size();
      }
    });
    int j = 0;
    Object localObject2;
    label200:
    label202:
    do
    {
      if (j >= arrayOfab.length) {
        break;
      }
      ab localab = arrayOfab[j];
      if ((m != 0) || (localab.size() > 1))
      {
        localObject1 = localab.l();
        do
        {
          if (!((a.c.m)localObject1).e()) {
            break;
          }
          localObject2 = ((a.c.m)localObject1).a();
          localx1.a(((d)localObject2).e(), localab);
          localx1.a(((d)localObject2).f(), localab);
          ((a.c.m)localObject1).f();
          if (m != 0) {
            break label202;
          }
          if (bool) {
            break label200;
          }
        } while (!bool);
      }
      if (m == 0) {
        j++;
      }
    } while (!bool);
    HashMap localHashMap = new HashMap();
    int k = 0;
    Object localObject1 = paramq.v();
    do
    {
      do
      {
        if (!((w)localObject1).e()) {
          break;
        }
        localObject2 = localx1.get(((w)localObject1).d());
        if (m == 0) {}
        Integer localInteger = localObject2 == null ? new Integer(k++) : (Integer)localHashMap.get(localObject2);
        if (m == 0)
        {
          if (localInteger == null)
          {
            localInteger = new Integer(k++);
            localHashMap.put(localObject2, localInteger);
          }
          paramx.a(((w)localObject1).d(), localInteger.intValue());
          ((w)localObject1).f();
        }
      } while (!bool);
    } while (m != 0);
    return k;
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.a.n

 * JD-Core Version:    0.7.0.1

 */